package com.springboot.controller;

import com.springboot.model.validator.CreateValidator;
import com.springboot.model.validator.QueryValidator;
import com.springboot.model.validator.UpdateValidator;
import com.springboot.model.validator.ValidatorDto;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: TongRui乀
 * @Date: 2020-04-13 9:38
 * @description：
 */
@Slf4j
@RestController
@RequestMapping("validator")
public class ValidatorController {

    @PostMapping("validator_01")
    public String validator_01(@RequestBody @Validated(QueryValidator.class) ValidatorDto dto){

      log.info("{}", dto);

      return "SUCCESS";
    }


    @PostMapping("validator_02")
    public String validator_02(@RequestBody @Validated(CreateValidator.class) ValidatorDto dto){

        log.info("{}", dto);

        return "SUCCESS";
    }


    @PostMapping("validator_03")
    public String validator_03(@RequestBody @Validated(UpdateValidator.class) ValidatorDto dto){

        log.info("{}", dto);

        return "SUCCESS";
    }

}
